﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _2_4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                int n1 = int.Parse(txtNum1.Text);
                int n2 = int.Parse(txtNum2.Text);
                int n3 = int.Parse(txtNum3.Text);
                int temp;
                string s;

                // 从大到小排序
                if (n1 < n2)
                {
                    temp = n1;
                    n1 = n2;
                    n2 = temp;
                }
                if (n1 < n3)
                {
                    temp = n1;
                    n1 = n3;
                    n3 = temp;
                }
                if (n2 < n3)
                {
                    temp = n2;
                    n2 = n3;
                    n3 = temp;
                }

                s = n1.ToString() + " > " + n2.ToString() + " > " + n3.ToString();
                txtResult.Text = s;
            }
            catch (Exception ex)
            {
                MessageBox.Show("请输入有效的整数！");
            }
        }

        private void btnAsc_Click(object sender, EventArgs e)
        {
            try
            {
                int n1 = int.Parse(txtNum1.Text);
                int n2 = int.Parse(txtNum2.Text);
                int n3 = int.Parse(txtNum3.Text);
                int temp;
                string s;

                // 从小到大排序
                if (n1 > n2)
                {
                    temp = n1;
                    n1 = n2;
                    n2 = temp;
                }
                if (n1 > n3)
                {
                    temp = n1;
                    n1 = n3;
                    n3 = temp;
                }
                if (n2 > n3)
                {
                    temp = n2;
                    n2 = n3;
                    n3 = temp;
                }

                s = n1.ToString() + " < " + n2.ToString() + " < " + n3.ToString();
                txtResult.Text = s;
            }
            catch (Exception ex)
            {
                MessageBox.Show("请输入有效的整数！");
            }
        }
    }
}
